<template>
	<!-- 检查点列表项 -->
	<view>
		<view class="check-item" @click="goCheckDetail(item['房屋id'])" v-for="(item,index) in roomList" :key="index">
			<view class="top">
				<text>{{item['房屋名']}}</text>
				<!-- <view class="priority">{{checkPointType[item['检查点类型']]}}</view> -->
			</view>
			<view class="center">
				<text>户主：</text>
				<text style="color: #888">{{item['户主']['姓名']}}</text>
			</view>
			<view class="bottom">
				<text>房屋类型：</text>
				<text style="color: #888;">{{roomType[item['房屋类型']]}}</text>
			</view>
			<view class="arrow"></view>
			<view class="delete" @click.stop="onDelete(item.房屋id)">删除</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			roomList: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				roomType: this.$type.roomTypeObj,
				checkPointType: this.$type.checkPointType
			}
		},
		methods: {
			goCheckDetail(id) {
				this.$emit('detail', id)
				// uni.navigateTo({
				// 	url: '../../pages/roomDetail/roomDetail?id=' + id
				// })
			},
			onDelete(id) {
				this.$emit('delete', id)
			},
			goRoomList(id) {
				uni.navigateTo({
					url: '/fireGridCheck/roomList/roomList?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.check-item {
		// background-color: pink;
		position: relative;
		padding: 20rpx 35rpx 22rpx 35rpx;
		font-size: 28rpx;
		line-height: 48rpx;
		margin-bottom: 10rpx;
		background-color: #fff;
		border-bottom: 10rpx solid #F5F5F5;
		.room {
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			color: #fff;
			background-color: #3080FB;
			// border: 2rpx solid #3080FB;
			font-size: 26rpx;
			text-align: center;
			height: 40rpx;
			padding: 0 14rpx;
			line-height: 40rpx;
			// margin-left: 18rpx;
		}
		.top {
			display: flex;
			font-size: 32rpx;
			align-items: center;
	
			&:before {
				display: inline-block;
				content: "";
				width: 6rpx;
				height: 32rpx;
				background-color: #3080FB;
				transform: translateX(-10rpx);
			}
	
			.priority {
				// min-width: 84rpx;
				color: #3080FB;
				border: 2rpx solid #3080FB;
				font-size: 20rpx;
				text-align: center;
				height: 28rpx;
				padding: 0 14rpx;
				line-height: 24rpx;
				margin-left: 18rpx;
			}
			.priority.low{
				color: #E57544;
				border: 2rpx solid #F29B76;
			}
			.priority.midium{
				color: #E57544;
				border: 2rpx solid #F29B76;
			}
			.priority.high{
				color: #E57544;
				border: 2rpx solid #F29B76;
			}
		}
		.bottom {
			overflow:hidden;//超出的隐藏
			text-overflow:ellipsis;//省略号
			white-space:nowrap;//强制一行显示
		}
		.arrow {
			width: 24rpx;
			height: 24rpx;
			border-top: 2rpx solid #999;
			border-right: 2rpx solid #999;
			transform: rotate(45deg);
			position: absolute;
			top: 60rpx;
			right: 40rpx;
		}
		.delete {
			position: absolute;
			right: 40rpx;
			bottom: 20rpx;
			text-align: center;
			line-height: 40rpx;
			width: 80rpx;
			height: 40rpx;
			font-size: 24rpx;
			color: #E57544;
			border: 2rpx solid #E57544;
		}
	}
</style>